<template>
  <div class="watchorder">
    <div class="header">
      <div class="container">
        <div class="header-left">
          <img src="../assets/car.gif" alt="" />
        </div>
        <div class="header-right">
          <div class="title">{{ orderdetail._status._msg }}</div>
          <div class="time">{{ orderdetail._pay_time }}</div>
        </div>
      </div>
    </div>
    <div class="step">
      <div class="container">
        <van-steps :active="active">
          <van-step>待付款</van-step>
          <van-step>待发货</van-step>
          <van-step>待收货</van-step>
          <van-step>待评价</van-step>
          <van-step>已完成</van-step>
        </van-steps>
      </div>
    </div>
    <div class="user-info">
      <van-cell>
        <template #title>
          {{ orderdetail.real_name }}
          {{ orderdetail.user_phone }}
        </template>
        <template #label>
          {{ orderdetail.user_address }}
        </template>
      </van-cell>
    </div>

    <div class="goodCount">共{{ orderdetail.cartInfo.length }}件商品</div>

    <div class="vanCard">
      <van-card
        v-for="item in orderdetail.cartInfo"
        :key="item.id"
        :num="item.cart_num"
        :price="item.productInfo.price"
        :desc="item.productInfo.attrInfo.suk"
        :title="item.productInfo.store_name"
        :thumb="item.productInfo.image"
      />
    </div>

    <div class="contact">
      <van-icon name="service-o" />
      <div>联系客服</div>
    </div>

    <div class="cell">
      <van-cell title="订单编号:" :value="orderdetail.order_id" />
      <van-cell title="下单时间:" :value="orderdetail._pay_time" />
      <van-cell title="订单类型:" value="普通订单" />
      <van-cell title="支付状态:" :value="orderdetail._status._title" />
      <van-cell title="支付方式:" :value="orderdetail._status._payType" />
    </div>

    <div class="cell">
      <van-cell title="支付金额:" :value="orderdetail.cost" />
    </div>

    <van-submit-bar button-text="申请退款" />
  </div>
</template>

<script>
export default {
  name: "WatchOrder",
  methods: {},
  data() {
    return {
      orderdetail: null,
      active: 1,
    };
  },
  props: {},
  created() {
    this.orderdetail = this.$route.query.orderInfo;
    console.log(this.orderdetail);
    if (this.$route.query.status) {
      this.active = this.$route.query.status;
    }
  },
};
</script>

<style lang="less">
.container {
  padding: 0rem 1rem;
}
.watchorder {
  padding-bottom: 3.15rem;
  .header {
    height: 4.5rem;
    background-color: #e93323;
    .container {
      display: flex;
      align-items: center;
      height: 4.5rem;
      .header-left {
        img {
          height: 3.5rem;
        }
      }
      .header-right {
        height: 2.4rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        color: white;
        margin-left: 1rem;
        .title {
          font-size: 0.93rem;
          font-weight: bold;
        }
        .time {
          font-size: 0.6rem;
          letter-spacing: 0.05rem;
          color: #e2e2e2;
        }
      }
    }
  }
  .step {
    .container {
      .van-step--finish .van-step__circle,
      .van-step--finish .van-step__line {
        background-color: #e93323;
      }
      .van-step__icon--active,
      .van-step__icon--finish,
      .van-step__title--active,
      .van-step__title--finish {
        color: #e93323;
      }
    }
  }
  .user-info {
    position: relative;
    &::after {
      content: "";
      position: absolute;
      background-image: -webkit-repeating-linear-gradient(
        135deg,
        #ff6c6c 0,
        #ff6c6c 20%,
        transparent 0,
        transparent 25%,
        #1989fa 0,
        #1989fa 45%,
        transparent 0,
        transparent 50%
      );
      bottom: 0rem;
      left: 0rem;
      height: 0.1rem;
      width: 100%;
      background-size: 5rem;
    }
    .van-cell {
      font-size: 15px;
      padding: 16px;
    }
    .van-cell__label {
      font-size: 13px;
    }
  }
  .goodCount,
  .contact {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    letter-spacing: 0.05rem;
    margin: 0.2rem 0rem;
    border-top: 0.4rem solid #f3f3f3;
  }
  .vanCard {
    .van-card {
      .van-card__thumb {
        .van-image {
          img {
            object-fit: contain !important;
          }
        }
      }
    }
  }
  .van-card__price {
    color: #e93323;
  }
  .van-card:not(:first-child) {
    margin-top: 3px;
  }
  .van-card__title {
    font-size: 13px;
    color: black;
    margin-bottom: 5px;
  }
  .contact {
    color: #e93323;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 0.4rem solid #f3f3f3;
    border-top: none;
  }
  .cell {
    border-bottom: 0.4rem solid #f3f3f3;
    padding: 0.3rem 0rem;
    .van-cell {
      padding: 3px 16px;
      color: black;
      font-size: 14px;
    }
  }
  .van-submit-bar {
    z-index: 1000;
  }
  .van-submit-bar__button {
    width: 90px;
    height: 28px;
    font-weight: 500;
    color: #949494;
    border: 1px solid #949494;
    background-color: transparent;
  }
  .van-submit-bar__button--danger {
    background: none;
  }
}
</style>